/**
 * 
 */
package com.haisen.lee.util;

import java.util.HashMap;
import java.util.Map;

import com.haisen.lee.service.IDomParserThread;
import com.haisen.lee.thread.HtmlDomParserThreadImpl;

/**
 * @author Haisen Lee
 * 
 *         single mode
 */
public class DomTypeToThreadUtil {

	private Map<DOMParserType, Class<? extends IDomParserThread>> domTypeToThreadDictionary = new HashMap<DOMParserType, Class<? extends IDomParserThread>>();
	private static DomTypeToThreadUtil domTypeToThreadUtil = null;

	/**
	 * 
	 */
	private DomTypeToThreadUtil() {
		init();
	}

	private void init() {
		domTypeToThreadDictionary.put(DOMParserType.HTML,
				HtmlDomParserThreadImpl.class);
		// TODO put other elements
	}

	public static DomTypeToThreadUtil getInstance() {
		synchronized (DomTypeToThreadUtil.class) {
			if (domTypeToThreadUtil == null) {
				domTypeToThreadUtil = new DomTypeToThreadUtil();
			}
		}
		return domTypeToThreadUtil;
	}

	public Map<DOMParserType, Class<? extends IDomParserThread>> getDomTypeToThreadDictionary() {
		return domTypeToThreadDictionary;
	}

}
